package com.android.common.base.rv;

import android.view.View;
import androidx.recyclerview.widget.RecyclerView;


public abstract class BaseRvHolder<T> extends RecyclerView.ViewHolder {

    public BaseRvHolder(View itemView) {
        super(itemView);
    }

    public abstract void bindData(T t, int position);

    public void toBindData(T t, int position) {
        bindData(t, position);
    }

    public interface ChildViewClickListener{
        void onChildViewClick(View view, int position);
    }

    public interface ChildViewSwitchChangedListener{
        void onSwitchChanged(int position,boolean isChecked);
    }

    public interface ChildViewCheckedListener{
        void onSwitchChanged(View view, int position,boolean isChecked);
    }


    public ChildViewClickListener mChildViewClickListener;

    public ChildViewSwitchChangedListener mSwitchChangedListener;

    public ChildViewCheckedListener mChildViewCheckedListener;

    public void setChildViewClickListener(ChildViewClickListener listener){
        mChildViewClickListener = listener;
    }

    public void setSwitchChangedListener(ChildViewSwitchChangedListener listener){
        mSwitchChangedListener = listener;
    }

    public void setChildViewCheckedListener(ChildViewCheckedListener listener){
        mChildViewCheckedListener = listener;
    }

}
